var vue = new Vue({
    el:"#app",
    data:{
        page:{},
        toasts:[],
        themes:{}
    },
    methods:{
        doPage:function(page){
            var param = getParams();
            var themeId = $("._j_tag.on").data("tid");
            ajaxGet("/strategies/query",{destId:param.destId, currentPage:page, themeId:themeId}, function (data) {
                vue.page = data.data;
                vue.page.number = page;   //指定当前页
                buildPage(vue.page.number, vue.page.totalPages,vue.doPage);
            })
        },
        themeSelect:function(themeId, event){
            $("._j_tag").removeClass("on");
            $(event.currentTarget).addClass("on");
            vue.doPage(1);
        }
    },
    mounted:function () {
        var param = getParams();
        //吐司
        ajaxGet("/destinations/toasts",{destId:param.destId}, function (data) {
            var list = data.data;
            vue.toasts = list;
        });
        //攻略主题
        ajaxGet("/strategies/themes",{}, function (data) {
            vue.themes = data.data;
        });
        //攻略分页
        ajaxGet("/strategies/query",{destId:param.destId}, function (data) {
            vue.page =data.data;
            console.log(data.data);
            //分页
            buildPage(vue.page.number, vue.page.totalPages,vue.doPage);
        });
    }
});

